/*
 * @Author: zwf 240970521@qq.com
 * @Date: 2023-07-16 10:36:55
 * @LastEditors: zwf 240970521@qq.com
 * @LastEditTime: 2023-07-17 21:07:10
 * @FilePath: /esp32_motor/modbusSlave/modbusSlave.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#ifndef MODBUS_SLAVE_H
#define MODBUS_SLAVE_H

#include "esp_err.h"
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"


typedef struct
{
    void         *addr;
    int           regAddr;
    int           size;
    QueueHandle_t queue;
} ModbusSlaveReg;


void MODBUS_slaveInit(void);
/*寄存器注册，注册前需要先创建消息队列*/
esp_err_t MODBUS_holdRegRegister(ModbusSlaveReg reg);
void      MODBUS_holdRegUnRegister(ModbusSlaveReg reg);

#endif
